package dp.mobile.entity.generator;

import dp.mobile.entity.generator.GeneratorFactory.GeneratorAttribute;
import dp.mobile.glwrapper.GLTexture;

public class GeneratorData {
	public GeneratorData(int regen, int regenTime, GLTexture image, GeneratorAttribute power, GeneratorAttribute range, GeneratorAttribute voltage) {
		mRegen 		= regen;
		mImage 		= image;
		mPower 		= power;
		mRange 		= range;
		mVoltage 	= voltage;
		mRegenPeriode = regenTime;
		mWorth		= new int[] {0, 0, 0};
		
		for (int i = 0; i < 3; ++i) {
			mWorth[i] += mPower.getWorth(i);
			mWorth[i] += mRange.getWorth(i);
			mWorth[i] += mVoltage.getWorth(i);
		}
	}
	
	public GLTexture getImage() {
		return mImage;
	}
	
	float getDamageBonus() {
		return mPower.getValue();
	}
	
	public float getRange() {
		return mRange.getValue();
	}
	
	float getSpeedBonus() {
		return mVoltage.getValue();
	}
	
	public int getRegen() {
		return mRegen;
	}
	
	int getRegenPeriode() {
		return mRegenPeriode;
	}
	
	public int getPowerLevel() {
		return mPower.getLevel();
	}
	
	public int getRangeLevel() {
		return mRange.getLevel();
	}
	
	public int getVoltageLevel() {
		return mVoltage.getLevel();
	}
	
	public int getGeneratorLevel() {
		return mPower.getLevel() + mRange.getLevel() + mVoltage.getLevel();
	}
	
	GeneratorAttribute getPowerAttribute() {
		return mPower;
	}
	
	GeneratorAttribute getRangeAttribute() {
		return mRange;
	}
	
	GeneratorAttribute getVoltageAttribute() {
		return mVoltage;
	}
	
	public int getBuildCost() {
		return GeneratorFactory.instance().getBaseBuildCost();
	}
	
	int getDismantleCost() {
		return GeneratorFactory.instance().getBaseDismantleCost() * getGeneratorLevel();
	}
	
	int getDismantleTime() {
		return GeneratorFactory.instance().getBaseDismantleTime() * getGeneratorLevel();
	}
	
	int getTransferTime() {
		return GeneratorFactory.instance().getBaseTransferTime() * getGeneratorLevel();
	}
	
	public int getWorth(int comp) {
		return mWorth[comp];
	}
	
	private int[] mWorth;
	private int mRegen;
	private int mRegenPeriode;
	private GLTexture mImage;
	private GeneratorAttribute mPower, mRange, mVoltage;
}
